//
//  CompleteOrderTableViewCell.m
//  SeaMelonSeeds_Counselor
//
//  Created by 尤振宇 on 2017/8/3.
//  Copyright © 2017年 杨笑. All rights reserved.
//

#import "CompleteOrderTableViewCell.h"
#import "UIButton+LayoutEdgeInsets.h"
#import "Tool+PsychologicalCounselling.h"

@implementation CompleteOrderTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    
    [self.detailsBtn layoutImageToRight:2];
    
    self.backgroundColor = [UIColor clearColor];
    self.contentView.backgroundColor = [UIColor clearColor];
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (IBAction)details:(id)sender {
    if (self.touchCheckDetails) {
        self.touchCheckDetails(sender);
    }
}

-(void)setOrder:(Order *)order type:(OrderType)type
{
    
    
    [self.headPortrait sd_setImageWithURL:[NSURL URLWithString:order.user_avatar] placeholderImage:[UIImage imageNamed:@"My_TheDefaultAvatar"]];
    self.title.text = [NSString stringWithFormat:@"%@  %d岁  %@",order.nickname,order.age,order.sex?@"女":@"男"];
    self.describe.object = order;
    
    if (!order.is_pay) {
       self.payInformation.text = @"订单状态:用户取消";
        if (type == mianduimian_OrderType) {
            if (order.refused_at || order.counselor_timeouted_at) {
                self.payInformation.text = @"订单状态:已拒绝";
            }
        }
        self.pay.text = @"未支付";
    }else{
       self.payInformation.text = [NSString stringWithFormat:@"订单状态: %@咨询%d次",[Tool TypeString:type],order.count];
        self.pay.text = [NSString stringWithFormat:@"已支付: %.0f",order.total_fee];
    }
    self.bookingNo.text = [NSString stringWithFormat:@"预约号: %@",order.out_trade_no];
    self.createdTime.text = [NSString stringWithFormat:@"下单时间: %@",order.created_at];
    
}

@end
